﻿@inherits ExceptionsBase

<div class="card">
    <div class="card-header">
        <span>查询结果</span>
    </div>
    <div class="card-body">
        <Table Id="exception" TItem="Bootstrap.DataAccess.Exceptions" ShowToolBar="true" ShowSearch="true" ShowAdvancedSearch="false" ShowRefresh="true" QueryModel="QueryModel" EditModel="DataContext" OnQuery="Query">
            <TableHeader>
                <LgbTableHeader TItem="DateTime" @bind-Value="@context.LogTime" class="text-nowrap datetime"></LgbTableHeader>
                <LgbTableHeader TItem="string" @bind-Value="@context.ErrorPage"></LgbTableHeader>
                <LgbTableHeader TItem="string" @bind-Value="@context.UserId" class="text-nowrap"></LgbTableHeader>
                <LgbTableHeader TItem="string" @bind-Value="@context.UserIp" class="text-nowrap"></LgbTableHeader>
                <LgbTableHeader TItem="string" @bind-Value="@context.ExceptionType"></LgbTableHeader>
                <LgbTableHeader TItem="string" @bind-Value="@context.Message"></LgbTableHeader>
            </TableHeader>
            <RowTemplate>
                <td>@context.LogTime</td>
                <td class="text-nowrap">@context.ErrorPage</td>
                <td>@context.UserId</td>
                <td>@context.UserIp</td>
                <td class="text-nowrap">@context.ExceptionType</td>
                <td>@context.Message</td>
            </RowTemplate>
            <TableToolbarTemplate>
                <TableToolbarButton class="btn btn-danger" Icon="fa fa-file-text-o" Title="服务器日志" OnClick="ShowDetail" />
            </TableToolbarTemplate>
        </Table>
    </div>
</div>

<Modal @ref="Modal" Id="exception-detail" Title="程序异常日志窗口" Size="ModalSize.Large">
    <ModalBody>
        <form class="form-inline">
            <div class="row">
                @foreach (var item in Items)
                {
                    <div class="form-group col-md-3 col-sm-4 col-6">
                        <a href="#" @onclick:preventDefault OnClick="e => ShowLog(item)">@item</a>
                    </div>
                }
            </div>
        </form>
    </ModalBody>
    <ModalFooter>
        <button type="button" class="btn btn-secondary" data-dismiss="modal">
            <i class="fa fa-times"></i>
            <span>关闭</span>
        </button>
    </ModalFooter>
</Modal>
